Fuel ASM
Instruction set for the FuelVM.
Compile features
std
: Unless set, the crate will link to the core-crate instead of the std-crate. More info here.serde
: Add support for serde for the types exposed by this crate.
Example
use *;
// A sample program to perform ecrecover
let program = vec!;
// Convert program to bytes representation
let bytes: = program.iter.copied.collect;
// A program can be reconstructed from an iterator of bytes
let restored: = from_bytes.collect;
assert_eq!;
// Every instruction can be described as `u32` big-endian bytes
let halfwords: = program.iter.copied.collect;
let bytes = halfwords.iter.copied.map.flatten;
let restored: = from_bytes.collect;
assert_eq!;
// We can also reconstruct the instructions individually
let restored: = from_u32s.collect;
assert_eq!;
// An instruction is composed by the opcode representation, register IDs and immediate value.
let instruction = program;
assert_eq!;
let slli = match instruction ;
let = slli.unpack;
assert_eq!;
assert_eq!;
assert_eq!;